/**
 * 后台请求路径
 */
var server_url='http://localhost:8089';
var usernameLocal="usernameLocal";
var passwordLocal="passwordLocal";
var name="name";
var photo="photo";
var userId="userId";
var satoken="satoken";
var username="username";
var password="password";

  $(document).ready(function () {
	  if(localStorage.getItem(satoken)!=null&&localStorage.getItem(password)!=null&&localStorage.getItem(username)!=null){
		  $("#login-menu").hide();
		  $("#login-menu-1").hide();
		  $("#login-user").show();
		  $("#login-user-1").show();
		  touxiang();
	  }else{
		  $("#login-user").hide();
		  $("#login-user-1").hide();
		  $("#login-menu").show();
		  $("#login-menu-1").show();
	  }
	    $(".option").addClass('notdisplay');
	  $("#option").hover(function(){
		  $(".option").removeClass('notdisplay');
	  })
	  $(".option-1").addClass('notdisplay');
	  $("#option-1").hover(function(){
	  		  $(".option-1").removeClass('notdisplay');
	  })
	 function touxiang(){
		 var mypic=document.getElementById("login-user-photo");
		 var mypic1=document.getElementById("login-user-photo-1");
		 mypic.src=localStorage.getItem(photo);
		 mypic1.src=localStorage.getItem(photo);
	 }
	  
	  //退出登录
	  $(".login-out").on('click', function() {
	  		var userVo = {
	  			'username': localStorage.getItem(username),
	  			'password': localStorage.getItem(password),
	  			'token': localStorage.getItem(satoken)
	  		}
	  		$.post(server_url + "/loginOut", userVo, function(msg) {
	  			if (msg.success == '0') {
				localStorage.removeItem(username);
				localStorage.removeItem(password);
				localStorage.removeItem(satoken);	
				localStorage.removeItem(photo);
				location.reload();
	  			}	  		
				
	  		});
	  	});
  })
  